<?php

require_once('config.php');
require_once('session.php');
$user = $_POST['username'];
$nome = $_POST['nome'];

$admin = usuarios_admin($user);
if ($admin == 1) {
    set_session($nome, $user, $admin);
    echo '<script language="JavaScript">location.href="index.php";</script>';
} else {
    $col = check_coligada($user); //coligada
    if ($col == 3) {
        set_session($nome, $user, $admin);
        echo '<script language="JavaScript">location.href="index.php";</script>';
    } else {
        echo '<script language="JavaScript">location.href="index.php?erro=4";</script>';
    }
}


